#include<iostream>
#include<vector>
#include<queue>
#include<unordered_map>

using namespace std;

int func1()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	s = " " + s;

	vector<int> st(26);
	long long tot = 0;
	for (int i = 1; i <= n; i++)
	{
		char c = s[i] - 'a';
		st[c]++;
		tot += st[c];
		long long l = i;
		long long t = (l + 1) * l / 2;
		long long sum = t - tot;
		cout << sum << endl;
	}
	return 0;
}

int func2()
{
	int q;
	cin >> q;
	const int mod = 1e9 + 7;
	while (q--)
	{
		int n, a, b, c;
		cin >> n >> a >> b >> c;
		vector<vector<long long>> f(n + 1, vector<long long>(3));
		f[0][1] = 1;
		for (int i = 1; i <= n; i++)
		{
			if (i >= a)
				f[i][0] = (f[i - a][0] + f[i - a][1] + f[i - a][2]) % mod;
			if(i >= b)
				f[i][1] = (f[i - b][0] + f[i - b][1] + f[i - b][2]) % mod;
			if (i >= c)
				f[i][2] = (f[i - c][1] + f[i - c][2]) % mod;
		}

		for (int i = 1; i <= n; i++)
		{
			cout << (f[i][0] + f[i][1] + f[i][2]) % mod << " ";
		}
		cout << endl;
	}

	return 0;
}

int main()
{
	int q;
	cin >> q;
	long long n, x, y,a,b;
	while (q--)
	{
		cin >> n >> x >> y;
		if (x > y)
		{
			cout << x * n << endl;
			continue;
		}
		vector<vector<int>> path(n + 1);
		vector<int> in(n + 1);
		for (int i = 0; i < n-1; i++)
		{
			cin >> a >> b;
			in[a]++;
			in[b]++;
			path[a].push_back(b);
			path[b].push_back(a);
		}

		queue<int> q;
		vector<bool> inq(n + 1);
		for (int i = 1; i <= n; i++)
			if (in[i] == 1)
			{
				in[i]--;
				q.push(i);
				inq[i] = true;
			}

		long long res = 0;
		vector<bool> st(n + 1);
		while (q.size())
		{
			auto t = q.front();
			q.pop();
			if (in[t] == 0 && !st[t])
			{
				res += y;
				for (auto it : path[t])
				{
					in[it]--;
					st[it] = true;
					if (!inq[it])
					{
						q.push(it);
						inq[it] = true;
					}
				}
			}
			else
			{
				res += x;
				for (auto it : path[t])
				{
					in[it]--;
					if (!inq[it])
					{
						q.push(it);
						inq[it] = true;
					}
				}
			}
		}
		cout << res << endl;
	}
	return 0;
}